package main

import (
	"backendChat/models"
	"fmt"

	"gorm.io/driver/mysql"
	"gorm.io/gorm"
)

func CreateTable() {
	db, _ := gorm.Open(mysql.Open("root:jx1314@tcp(127.0.0.1:3306)/chatdb?charset=utf8mb4&parseTime=True&loc=Local"), &gorm.Config{})
	fmt.Println("表创建...")
	err := db.AutoMigrate(&models.UserBasic{})
	if err != nil {
		panic(err)
	}
	fmt.Println("表创建成功")
	fmt.Println("connect mysql success")
}

func main() {
	CreateTable()
}
